package com.sigmatrix.h5.web.mode;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

/**
 * 
 *@ClassName: RebateRecord
 *@Description:扫码返利详情
 *@author MH
 *@date 2018年1月26日 上午9:24:55
 */
public class RebateRecord {
	
	/**
	 * 活动id
	 */
	@JSONField(name="pri")
	private Integer promotionId;
	
	@JSONField(name="n")
	private String time;
	/**
	 * 企业编码
	 */
	@JSONField(name="e")
	private String eseCode;
	
	/**
	 * 码的域名
	 */
	@JSONField(name="d")
	private String domain;
	
	/**
	 * 二级域名
	 */
	@JSONField(name="u")
	private String subDomain;
	
	/**
	 * 码序列号
	 */
	@JSONField(name="q")
	private String seqNum;
	/**
	 * 扫码的终端店或者经销商ID
	 */
	@JSONField(name="i")
	private Integer scanId;
	
	/**
	 * 产品ID
	 */
	@JSONField(name="p")
	private Integer productId;
	/**
	 * 扫码对象的类型 2经销商 3终端店(目前中粮只有终端店)
	 */
	@JSONField(name="t")
	private Short scanType;
	
	/**
	 * 扫码的openId
	 */
	@JSONField(name="o")
	private String openId;
	
	/**
	 * 返利的明细
	 */
	@JSONField(name="s")
	private List<Rebate> rebates;
	
	public static class Rebate{
		
		/**
		 * 返利对象ID
		 */
		@JSONField(name="i")
		private Integer rebateId;
		
		/**
		 * 返利对象类型(2经销商 3终端店 4业务员)
		 */
		@JSONField(name="t")
		private Short rebateType;
		
		/**
		 * 返利金额，单位元
		 */
		@JSONField(name="m")
		private BigDecimal amount;
		
		@JSONField(name="a")
		private Integer auditId;
		
		public Integer getRebateId() {
			return rebateId;
		}

		public void setRebateId(Integer rebateId) {
			this.rebateId = rebateId;
		}

		public Short getRebateType() {
			return rebateType;
		}

		public void setRebateType(Short rebateType) {
			this.rebateType = rebateType;
		}

		public BigDecimal getAmount() {
			return amount;
		}

		public void setAmount(BigDecimal amount) {
			this.amount = amount;
		}

		public Rebate() {
			super();
		}

		public Integer getAuditId() {
			return auditId;
		}

		public void setAuditId(Integer auditId) {
			this.auditId = auditId;
		}

		public Rebate(Integer rebateId, Short rebateType, BigDecimal amount, Integer auditId) {
			super();
			this.rebateId = rebateId;
			this.rebateType = rebateType;
			this.amount = amount;
			this.auditId = auditId;
		}
		
	}

	public Integer getScanId() {
		return scanId;
	}

	public void setScanId(Integer scanId) {
		this.scanId = scanId;
	}

	public Short getScanType() {
		return scanType;
	}

	public void setScanType(Short scanType) {
		this.scanType = scanType;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public List<Rebate> getRebates() {
		return rebates;
	}

	public void setRebates(List<Rebate> rebates) {
		this.rebates = rebates;
	}
	
	public static void main(String[] args) {
		RebateRecord record = new RebateRecord();
		record.setOpenId("111");
		record.setEseCode("zhongliang");
		record.setScanId(1);
		record.setScanType(Short.valueOf("2"));
		record.setProductId(12);
		List<Rebate> list = new ArrayList<Rebate>();
		Rebate rebate = new Rebate();
		rebate.setAmount(new BigDecimal(100));
		rebate.setRebateId(1);
		rebate.setRebateType(Short.valueOf("3"));
		list.add(rebate);
		record.setRebates(list);
		System.out.println(JSONObject.toJSONString(new RebateRecord("11", "domain", "subDomain", 11+"", 2, 1, null, "22", null)));
	}


	public RebateRecord(String eseCode, String domain, String subDomain, String seqNum, Integer scanId,
			Integer productId, Short scanType, String openId, List<Rebate> rebates) {
		super();
		this.eseCode = eseCode;
		this.domain = domain;
		this.subDomain = subDomain;
		this.seqNum = seqNum;
		this.scanId = scanId;
		this.productId = productId;
		this.scanType = scanType;
		this.openId = openId;
		this.rebates = rebates;
		this.time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
	}

	public RebateRecord() {
		super();
	}

	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	public String getEseCode() {
		return eseCode;
	}

	public void setEseCode(String eseCode) {
		this.eseCode = eseCode;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getSubDomain() {
		return subDomain;
	}

	public void setSubDomain(String subDomain) {
		this.subDomain = subDomain;
	}

	public String getSeqNum() {
		return seqNum;
	}

	public void setSeqNum(String seqNum) {
		this.seqNum = seqNum;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public Integer getPromotionId() {
		return promotionId;
	}

	public void setPromotionId(Integer promotionId) {
		this.promotionId = promotionId;
	}
	
	
}
